package servletUser;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Administrator on 2020/12/4.
 */
public class Servlet1 extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //查看参数
        String username = req.getParameter("username");
        System.out.println("在servlet1中查看材料");
        //盖章
        req.setAttribute("key1","servlet1");
        System.out.println("在servlet1盖好章");
        //问路
        RequestDispatcher requestDispatcher = req.getRequestDispatcher("/servlet2");
        //走到servlet2
        requestDispatcher.forward(req,resp);
    }
}
